<?php defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); ?>

<form action="index2.php" method="post" name="adminForm">
    <table cellpadding="4" cellspacing="0" border="0" width="100%">
        <tr>
            <td width="100%" class="sectionname"><?php echo $this->project->getName(); ?></td>
        </tr>
    </table>

    <table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
        <tr>
            <th>&nbsp;</th>
            <th width="1%" align="center">
                <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($this->rows); ?>);" />
            </th>
            <th width="5%"><?php echo 'Id'; ?></th>
            <th width="19%" class="title"><?php echo 'Name'; ?></th>
            <th width="5%"><?php echo 'Players'; ?></th>

            <th width="10%"><?php echo 'ShowResults'; ?></th>
            <th width="10%"><?php echo 'ShowTable'; ?></th>
            <th width="10%"><?php echo 'ShowSquad'; ?></th>
            <th width="10%"><?php echo 'ShowHistory'; ?></th>
            <th width="10%"><?php echo 'ShowClub'; ?></th>
            <th width="10%"><?php echo 'ShowNews'; ?></th>

            <th width="10%"><?php echo 'Action'; ?></th>
        </tr>

        <?php
        $k = 1;
        $i = 0;
        foreach ($this->rows as $row) {

            $tm = LM::getLMTable("Teammap");
            $tm->populate($row);

            $k = 1 - $k;

            $task3 = 'open';
            $img3 = 'folder-closed.gif';
            if ($this->team instanceof LM_Table_Team && $this->team->getID() == $tm->getTeamID()) {
                $task3 = 'close';
                $img3 = 'folder-open.gif';
            }

            $showResultImg  = $tm->showResults == 1 ? 'tick.png' : 'publish_x.png';
            $showTableImg   = $tm->showTable == 1 ? 'tick.png' : 'publish_x.png';
            $showSquadImg   = $tm->showSquad == 1 ? 'tick.png' : 'publish_x.png';
            $showHistoryImg = $tm->showHistory == 1 ? 'tick.png' : 'publish_x.png';
            $showClubImg    = $tm->showClub == 1 ? 'tick.png' : 'publish_x.png';
            $showNewsImg    = $tm->showNews == 1 ? 'tick.png' : 'publish_x.png';
        ?>
            <tr class="<?php echo "row$k"; ?>">
                <td align="center">
                    <a href="#<?php echo $task3; ?>" onclick="return listItemTask('cb<?php echo $i; ?>','<?php echo $task3; ?>')" onmouseover="this.T_DELAY=50;return escape('<b><?php echo $row->team_name; ?></b>: Manage Players!')">
                        <img src="../components/com_leagueman/images/<?php echo $img3; ?>" border="0" alt="" />
                    </a>
                </td>
                <td align="center">
                    <input type="checkbox" id="cb<?php echo $i; ?>" name="cid[]" value="<?php echo $tm->getID(); ?>" onclick="isChecked(this.checked);" />
                </td>
                <td align="center"><b><?php echo $tm->getID(); ?></b></td>
                <td>
                    <a href="#edit" onclick="return listItemTask('cb<?php echo $i; ?>','edit')" onmouseover="this.T_DELAY=50;return escape('<b><?php echo $row->team_name; ?></b>: Edit this Team!')">
                        <?php echo $row->team_name; ?>
                    </a>
                </td>
                <td align="center"><?php echo $row->players; ?></td>

                <td align="center">
                    <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i; ?>','toggleOptionShowResults')" onmouseover="this.T_DELAY=50;return escape('<b><?php echo 'Show Result Tab'; ?></b>')">
                        <img src="images/<?php echo $showResultImg; ?>" width="12" height="12" border="0" alt="" />
                    </a>
                </td>
                <td align="center">
                    <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i; ?>','toggleOptionShowTable')" onmouseover="this.T_DELAY=50;return escape('<b><?php echo 'Show Table Tab'; ?></b>')">
                        <img src="images/<?php echo $showTableImg; ?>" width="12" height="12" border="0" alt="" />
                    </a>
                </td>
                <td align="center">
                    <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i; ?>','toggleOptionShowSquad')" onmouseover="this.T_DELAY=50;return escape('<b><?php echo 'Show Squad Tab'; ?></b>')">
                        <img src="images/<?php echo $showSquadImg; ?>" width="12" height="12" border="0" alt="" />
                    </a>
                </td>
                <td align="center">
                    <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i; ?>','toggleOptionShowHistory')" onmouseover="this.T_DELAY=50;return escape('<b><?php echo 'Show History Tab'; ?></b>')">
                        <img src="images/<?php echo $showHistoryImg; ?>" width="12" height="12" border="0" alt="" />
                    </a>
                </td>
                <td align="center">
                    <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i; ?>','toggleOptionShowClub')" onmouseover="this.T_DELAY=50;return escape('<b><?php echo 'Show Club Tab'; ?></b>')">
                        <img src="images/<?php echo $showClubImg; ?>" width="12" height="12" border="0" alt="" />
                    </a>
                </td>
                <td align="center">
                    <a href="javascript: void(0);" onclick="return listItemTask('cb<?php echo $i; ?>','toggleOptionShowNews')" onmouseover="this.T_DELAY=50;return escape('<b><?php echo 'Show News Tab'; ?></b>')">
                        <img src="images/<?php echo $showNewsImg; ?>" width="12" height="12" border="0" alt="" />
                    </a>
                </td>

                <td align="center">
                    <a href="#unassign" onclick="javascript:if (confirm('Are you sure you want to unassign this item?')){return listItemTask('cb<?php echo $i; ?>','unassign')}" onmouseover="this.T_DELAY=50;return escape('<b><?php echo $row->team_name; ?></b>: Unassign from project <br/> <b><?php echo $this->project->getName(); ?>!</b>')">
                        <img src="images/trash.png" width="12" height="12" border="0" alt="" />
                    </a>
                </td>
            </tr>
        <?php
                    $i++;
                }
        ?>
    </table>

    <input type="hidden" name="option" value="com_leagueman" />
    <input type="hidden" name="act" value="teammap" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
</form>